Skip to content

Conversation

@sinkingsugar
Copy link
Member

Documents bugs, missing features, and improvements found during code review of shards/modules/physics:

P0 (Critical):

  • Memory leaks in body/constraint cleanup
  • ApplyForceAt logic bug (&&/|| operator)
  • Typo in assertion macro

P1 (Missing Features):

  • No raycasting/shape queries
  • Missing shape types (cylinder, mesh, heightfield)
  • Missing constraint types (hinge, cone, etc)
  • Body sleeping disabled

P2 (Improvements):

  • Soft body param detection broken
  • Hardcoded system limits
  • Various minor issues

Documents bugs, missing features, and improvements found during
code review of shards/modules/physics:

P0 (Critical):
- Memory leaks in body/constraint cleanup
- ApplyForceAt logic bug (&&/|| operator)
- Typo in assertion macro

P1 (Missing Features):
- No raycasting/shape queries
- Missing shape types (cylinder, mesh, heightfield)
- Missing constraint types (hinge, cone, etc)
- Body sleeping disabled

P2 (Improvements):
- Soft body param detection broken
- Hardcoded system limits
- Various minor issues
Copilot AI review requested due to automatic review settings November 22, 2025 09:04
Copilot finished reviewing on behalf of sinkingsugar November 22, 2025 09:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents findings from a comprehensive code review of the shards/modules/physics module, categorizing issues by priority (P0-Critical, P1-Missing Features, P2-Improvements). The documentation provides detailed descriptions, code examples, impact analysis, and suggested fixes for each identified issue, serving as a roadmap for physics module improvements.

Key changes:

  • Documents 5 critical bugs including memory leaks and logic errors
  • Identifies 5 missing feature categories (raycasting, shapes, constraints, sleeping, character controllers)
  • Lists 7 improvement opportunities ranging from broken parameter detection to empty help text

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
docs/physics-issues/P0-critical-bugs.md Documents 5 critical bugs including memory leaks in body/constraint cleanup, ApplyForceAt logic error, and assertion macro typo
docs/physics-issues/P1-missing-features.md Catalogs missing physics capabilities: raycasting/queries, additional shape types, constraint types, body sleeping, and character controller support
docs/physics-issues/P2-improvements.md Lists 7 lower-priority improvements including broken soft body parameter detection, hardcoded system limits, and missing documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

```cpp
void cleanup(SHContext *context) {
if (_instance.node && _instance.node->node) {
auto &bodyNode = _instance->node;
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name in the code example is inconsistent. Line 14 checks if (_instance.node && _instance.node->node) but line 15 declares auto &bodyNode = _instance->node;. This should be auto &bodyNode = _instance.node; to match the condition check.

Suggested change
auto &bodyNode = _instance->node;
auto &bodyNode = _instance.node;

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.73%. Comparing base (9679452) to head (07d4a52).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #1223      +/-   ##
==========================================
- Coverage   77.74%   77.73%   -0.01%     
==========================================
  Files         386      386              
  Lines       59575    59575              
==========================================
- Hits        46315    46313       -2     
- Misses      13260    13262       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sinkingsugar
Copy link
Member Author

@claude can you open the issues listed in the PR .md files

@claude
Copy link

claude bot commented Nov 22, 2025

Claude finished @sinkingsugar's task —— View job


Opening Issues from Physics Module Review

Status: Unable to Create Issues

I've analyzed all the documentation files and found 17 issues to create, but I don't have permission to create GitHub issues via the gh CLI in this environment.

Summary of Issues Found

P0 - Critical Bugs (5 issues):

  1. Memory Leak - Bodies Never Removed From Mirror Map (body.cpp:159-169)
  2. Memory Leak - Constraints Never Removed From Mirror Map (constraints.cpp:50-57)
  3. ApplyForceAt Has Incorrect Logic Operator (physics.cpp:703-709) - Uses && instead of ||
  4. Typo shasert Instead of shassert (core.hpp:198)
  5. Thread Buffer Lazy GC Can Cause Data Loss (core.hpp:81-85)

P1 - Missing Features (5 issues):

  1. No Raycasting or Shape Query Support - Missing Physics.Raycast, Physics.ShapeCast, etc.
  2. Missing Common Shape Types - No cylinder, mesh, heightfield, compound shapes
  3. Missing Constraint Types - No hinge, cone, point, six-DOF constraints
  4. No Body Sleeping Support - Explicitly disabled, hurting performance
  5. No Character Controller Support - Jolt's character system not exposed

P2 - Improvements (7 issues):

  1. Soft Body Parameter Change Detection Is Broken - Hash always returns 0
  2. Hardcoded Physics System Limits - 8K bodies, 4MB allocator not configurable
  3. No Collision Event Filtering by Type - Can't filter ContactAdded vs ContactPersisted
  4. Missing Physics.IsValid Check - No way to check if body reference is valid
  5. Factory Instance Memory Leak - Jolt Factory singleton never freed
  6. Debug Draw Help Text Is Empty
  7. SoftBodyShape Help Text Is Empty

Next Steps

To create these issues, you can either:

  1. Run Claude Code locally with gh CLI permissions
  2. Create the issues manually using the detailed descriptions in the PR files:
    • docs/physics-issues/P0-critical-bugs.md
    • docs/physics-issues/P1-missing-features.md
    • docs/physics-issues/P2-improvements.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants